\(\int \frac {\sec (x)}{-\cot (x)+\csc (x)} \, dx\) [213]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 12, antiderivative size = 13 \[ \int \frac {\sec (x)}{-\cot (x)+\csc (x)} \, dx=\log (1-\cos (x))-\log (\cos (x)) \]

[Out]

ln(1-cos(x))-ln(cos(x))

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 13, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.417, Rules used = {4477, 2786, 36, 29, 31} \[ \int \frac {\sec (x)}{-\cot (x)+\csc (x)} \, dx=\log (1-\cos (x))-\log (\cos (x)) \]

[In]

Int[Sec[x]/(-Cot[x] + Csc[x]),x]

[Out]

Log[1 - Cos[x]] - Log[Cos[x]]

Rule 29

Int[(x_)^(-1), x_Symbol] :> Simp[Log[x], x]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 36

Int[1/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Dist[b/(b*c - a*d), Int[1/(a + b*x), x], x] -
Dist[d/(b*c - a*d), Int[1/(c + d*x), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0]

Rule 2786

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(p_.), x_Symbol] :> Dist[1/f, Subst[I
nt[x^p*((a + x)^(m - (p + 1)/2)/(a - x)^((p + 1)/2)), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x]
&& EqQ[a^2 - b^2, 0] && IntegerQ[(p + 1)/2]

Rule 4477

Int[(cot[(c_.) + (d_.)*(x_)]^(n_.)*(a_.) + csc[(c_.) + (d_.)*(x_)]^(n_.)*(b_.))^(p_)*(u_.), x_Symbol] :> Int[A
ctivateTrig[u]*Csc[c + d*x]^(n*p)*(b + a*Cos[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\tan (x)}{1-\cos (x)} \, dx \\ & = -\text {Subst}\left (\int \frac {1}{x (1+x)} \, dx,x,-\cos (x)\right ) \\ & = -\text {Subst}\left (\int \frac {1}{x} \, dx,x,-\cos (x)\right )+\text {Subst}\left (\int \frac {1}{1+x} \, dx,x,-\cos (x)\right ) \\ & = \log (1-\cos (x))-\log (\cos (x)) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.92 \[ \int \frac {\sec (x)}{-\cot (x)+\csc (x)} \, dx=2 \log \left (\sin \left (\frac {x}{2}\right )\right )-\log \left (1-2 \sin ^2\left (\frac {x}{2}\right )\right ) \]

[In]

Integrate[Sec[x]/(-Cot[x] + Csc[x]),x]

[Out]

2*Log[Sin[x/2]] - Log[1 - 2*Sin[x/2]^2]

Maple [A] (verified)

Time = 0.37 (sec) , antiderivative size = 6, normalized size of antiderivative = 0.46

method result size
derivativedivides \(\ln \left (\sec \left (x \right )-1\right )\) \(6\)
default \(\ln \left (\sec \left (x \right )-1\right )\) \(6\)
risch \(2 \ln \left ({\mathrm e}^{i x}-1\right )-\ln \left ({\mathrm e}^{2 i x}+1\right )\) \(22\)

[In]

int(sec(x)/(csc(x)-cot(x)),x,method=_RETURNVERBOSE)

[Out]

ln(sec(x)-1)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.15 \[ \int \frac {\sec (x)}{-\cot (x)+\csc (x)} \, dx=-\log \left (-\cos \left (x\right )\right ) + \log \left (-\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) \]

[In]

integrate(sec(x)/(-cot(x)+csc(x)),x, algorithm="fricas")

[Out]

-log(-cos(x)) + log(-1/2*cos(x) + 1/2)

Sympy [F]

\[ \int \frac {\sec (x)}{-\cot (x)+\csc (x)} \, dx=- \int \frac {\sec {\left (x \right )}}{\cot {\left (x \right )} - \csc {\left (x \right )}}\, dx \]

[In]

integrate(sec(x)/(-cot(x)+csc(x)),x)

[Out]

-Integral(sec(x)/(cot(x) - csc(x)), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 41 vs. \(2 (13) = 26\).

Time = 0.23 (sec) , antiderivative size = 41, normalized size of antiderivative = 3.15 \[ \int \frac {\sec (x)}{-\cot (x)+\csc (x)} \, dx=-\log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} + 1\right ) - \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} - 1\right ) + 2 \, \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right ) \]

[In]

integrate(sec(x)/(-cot(x)+csc(x)),x, algorithm="maxima")

[Out]

-log(sin(x)/(cos(x) + 1) + 1) - log(sin(x)/(cos(x) + 1) - 1) + 2*log(sin(x)/(cos(x) + 1))

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.08 \[ \int \frac {\sec (x)}{-\cot (x)+\csc (x)} \, dx=\log \left (-\cos \left (x\right ) + 1\right ) - \log \left ({\left | \cos \left (x\right ) \right |}\right ) \]

[In]

integrate(sec(x)/(-cot(x)+csc(x)),x, algorithm="giac")

[Out]

log(-cos(x) + 1) - log(abs(cos(x)))

Mupad [B] (verification not implemented)

Time = 22.65 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.46 \[ \int \frac {\sec (x)}{-\cot (x)+\csc (x)} \, dx=2\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )-\ln \left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2-1\right ) \]

[In]

int(-1/(cos(x)*(cot(x) - 1/sin(x))),x)

[Out]

2*log(tan(x/2)) - log(tan(x/2)^2 - 1)